﻿using System;
using System.Collections;
using System.Collections.Generic;

using Ajeelee.Core.Database;
using Ajeelee.Core.Utils;
using AiLuWeb.Business;
using AiLuWeb.Model;
using AiLuWeb.WebSite.Code;

namespace AiLuWeb.WebSite.WebAdmin
{
    public partial class MyJobList : AuthPageBase
    {
        protected string mname = "";
        protected IList<MyJob> jobList = new List<MyJob>();
        IMyJobBusiness jobBll = new MyJobBusinessFactory().CreateMyJobBusiness();
        PageStructure ps = new PageStructure() { PageSize = 15, CurrPage = 1 };

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                mname = QueryParam("mname");
                ps.CurrPage = QueryParamInt32("page", 1);

                // 删除
                if (!string.IsNullOrEmpty(QueryParam("d")) && QueryParamInt32("d") > 0)
                {
                    jobBll.Delete(QueryParamInt32("d"));
                }

                Hashtable ht = new Hashtable();
                ht.Add(LanMuInfoHash.Name, Function.SafeSqlLiteral(mname));
                jobList = jobBll.GetAllMyJobByPage(ht, ps);
                pager1.PageStruct = ps;
            }
            catch (Exception ex)
            {
                Function.WriteErrorLog(ex);
            }
        }
    }
}